$(function() {
	
	/*
	 * 点击向下箭头
	 */
	$(".down").click(function(){
		swiper.slideTo(1, 1000, true);
	})
	
	/*
	 * 点击苹果
	 */
	$(".apple").click(function(){
		$(".big").toggle();
		$(".down").toggle();
	});
	
	/*
	 * 点击关闭
	 */
	$(".close").click(function(){
		$(".big").css("display","none")
		$(".bigM").css("display","none")
		$(".down").css("display","block");
	});
	
	/*
	 * 点击树
	 */
	$(".bigO").click(function(){
		$(".bigM").toggle();
		$(".down").toggle();
	});
	
	/*
	 * 天津游
	 */
	$(".tj_index").click(function(){
		swiper.slideTo(3, 1000, true);
	});
	
	/*
	 * 老杨的日常
	 */
	$(".rc_index").click(function(){
		swiper.slideTo(4, 1000, true);
	});
	
	/*
	 * 永久的回忆
	 */
	$(".hy_index").click(function(){
		swiper.slideTo(5, 1000, true);
	});
	
	/*
	 * 全家福
	 */
	$(".qjf_index").click(function(){
		swiper.slideTo(6, 1000, true);
	});
	
	/*
	 * 剧场版
	 */
	$(".jcb_index").click(function(){
		swiper.slideTo(7, 1000, true);
	});
	
	/*
	 * 返回
	 */
	$(".back").click(function(){
		swiper.slideTo(2, 1000, true);
	});
	var Page = (function() {

		var $navArrows = $('#nav-arrows').hide(),

			$navDots = $('#nav-dots').hide(),

			$nav = $navDots.children('span'),

			$shadow = $('#shadow').hide(),

			slicebox = $('#sb-slider').slicebox({

				onReady: function() {

					$navArrows.show();

					$navDots.show();

					$shadow.show();

				},

				onBeforeChange: function(pos) {

					$nav.removeClass('nav-dot-current');

					$nav.eq(pos).addClass('nav-dot-current');

				}

			}),

			init = function() {

				initEvents();

			},

			initEvents = function() {

				// add navigation events

				$navArrows.children(':first').on('click', function() {

					slicebox.next();

					return false;

				});

				$navArrows.children(':last').on('click', function() {

					slicebox.previous();

					return false;

				});

				$nav.each(function(i) {

					$(this).on('click', function(event) {

						var $dot = $(this);

						if(!slicebox.isActive()) {

							$nav.removeClass('nav-dot-current');

							$dot.addClass('nav-dot-current');

						}

						slicebox.jump(i + 1);

						return false;

					});

				});

			};

		return {
			init: init
		};

	})();

	Page.init();

	var img = document.getElementById("img");

	var count = 1;
	setInterval(function() {
		if(count == 30) {
			count = 1;
		}
		img.src = "img/rc_index/rc" + count + ".jpg";
		count++;
	}, 2500);
   
});